package org.niu.sort;

import java.util.Arrays;

public class MLS {
    public int MLS (int[] arr) {
        // write code here
        Arrays.sort(arr);
        int cnt = 1;
        int ans = 0;
        for (int i = 0; i < arr.length-1; i++) {
            if(arr[i+1]==arr[i]){
                continue;
            }
            if(arr[i+1]-arr[i] == 1){
                cnt++;
            }else{
                ans = Math.max(cnt,ans);
                cnt = 0;
            }
        }
        return ans;
    }
}
